import {  EggAppInfo } from 'egg';

export default (appInfo: EggAppInfo) => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config:any = {}
  config.oss = {
    SECRET_ID: "AKID9IoJ6qw2RF6tYVZApuzs3DQtZK2X2TD8",
    SECRET_KEY:"L1cUSMHXG2yGhAiFlkl7uqmiijpIhWGr",
    BUKET_NAME:"sdev-1323481303",
    REGION:"ap-guangzhou",
    SCHEME:"https"
  } 
  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1731310943127_3236';
  // 服务端接受 post 请求
  config.security = {
    csrf: {
      enable: false, // 将内置的安全系统关闭
      ignoreJSON: false,
      withCredentials: false,
      ignore: () => true,
    },
    domainWhiteList: ['*'],
  };
  config.xcx={
      "appID": "wxe7548f35d6fb7c2e",
      "jwtKey": "nihao6682",
      "accessTokenUrl":"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential",
      "secret": "d34bc4f6b96a260e3099104e85a257e9",
      "subscribeSendUrl":"https://api.weixin.qq.com/cgi-bin/message/subscribe/send",
      "templateId":"OfPni_DDnEpQxMDwyO96NXAii7GkySDRihqWtA7P9BA"
      // "templateIdFiled":"kpJ7Ozd5tQXtVnRs05FkXvKgBerlkaDyYqPjHQwIfB0"
  }
  config.sequelize = {
    dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
    host: '101.42.30.13',
    port: 3306,
    username: 'root',
    password: 'nihao6681',
    // host: '127.0.0.1',
    // port: 5432,
    // username: 'postgres',
    // password: '123456',
    database: 'recycle',
    timezone: '+08:00',
    define: {
      underscored: true,
    },
    pool: {
      max: 10,
      min: 5,
      acquire: 1000,
      idle: 10000,
      evict: 0,
    }
  };
    // redis缓存配置
    config.redis = {
      client: {
        port: 6379, // Redis port
        host: '101.42.30.13', // Redis host
        password: '',
        db: 10,
      },
      Redis: require('ioredis'),
    };
  // add your middleware config here
  config.middleware = [];

  config.session = {
    key: "EGG_SESSION",
    maxAge: 24 * 3600 * 1000, // 1 天
    httpOnly: true,
    encrypt: false
  };
  config.jwt = {
    secret: 'nihao6681',
  };
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
}
  // add your user config here
  config.multipart={
    mode: 'file',
    allowArrayField: true,
    fileSize: '5mb',

  }
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
